﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Server;

namespace Client
{
    /// <summary>
    /// Displays Directmessages and exposes functionality
    /// </summary>
    public partial class DMMessage : DMControlBase
    {
        public event DMPostEventhandler Reply;
        public DMMessage()
        {
            InitializeComponent();
        }
        protected virtual void OnReply(object sender, ReplyChatEventArgs<DMPost> e)
        {
            Reply(sender, e); // Reply(this,e) kept throwing exceptions.
        }
        public DMMessage(DMPost newentry)
        {
            InitializeComponent();
            this.myEntry = newentry;
            this.User = myEntry.Origin;
            this.kryptonHeader1.Values.Heading = newentry.MessageContent;
            this.kryptonHeader1.Values.Description = "From: " + User;
            this.User = myEntry.User;
        }

        private void buttonSpecAny1_Click(object sender, EventArgs e)
        {
            this.OnReply(this, new ReplyChatEventArgs<DMPost>(myEntry, User));
        }
    }
    public class DMControlBase : MessageBase<DMPost>
    { }
}
